import type { RouteRecordRaw } from 'vue-router'
/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      hidden：        是否隐藏此路由
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 静态路由（默认路由）
 */
export const staticRoutes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      hidden: true
    }
  },

  {
    path: '/404',
    name: '404',
    component: () => import('@/views/error/404.vue'),
    meta: {
      hidden: true
    }
  },

  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/home',
    children: [
      {
        path: 'home',
        name: 'Home',
        component: () => import('@/views/home/index.vue'),
        meta: {
          title: '首页',
          icon: 'ele-HomeFilled'
        }
      }
    ]
  },

  // 订单管理
  {
    path: '/ordermanagement',
    name: 'Ordermanagement',
    component: () => import('@/layout/index.vue'),
    meta: {
      title: '订单管理',
      icon: 'ele-HomeFilled'
    },
    children: [
      {
        path: 'manage',
        name: 'Manage',
        component: () => import('@/views/orderManageMent/manage/index.vue'),
        meta: {
          title: '订单管理'
        }
      },
      {
        path: 'demo',
        name: 'Demo',
        component: () => import('@/components/Test/index.vue'),
        meta: {
          title: '测试'
        }
      }
    ]
  }
]

/**
 * 定义动态路由
 */

// 抛出
export const asyncRouters = [
  // 权限管理
  {
    path: '/acl',
    name: 'Acl',
    component: () => import('@/layout/index.vue'),
    redirect: '/acl/user/list',
    meta: {
      title: '权限管理',
      icon: 'ele-Setting'
    },
    children: [
      {
        name: 'User',
        path: '/acl/user/list',
        component: () => import('@/views/acl/user/index.vue'),
        meta: {
          title: '用户管理'
        }
      },
      {
        name: 'Role',
        path: '/acl/role/list',
        component: () => import('@/views/acl/role/index.vue'),
        meta: {
          title: '角色管理'
        }
      },
      {
        name: 'RoleAuth',
        path: '/acl/role/auth',
        component: () => import('@/views/acl/role/roleAuth.vue'),
        meta: {
          title: '角色管理',
          hidden: true,
          activeMenu: '/acl/role/list'
        }
      },
      {
        name: 'Permission',
        path: '/acl/permission/list',
        component: () => import('@/views/acl/permission/index.vue'),
        meta: {
          title: '菜单管理'
        }
      }
    ]
  },
  // 商品管理
  {
    path: '/product',
    name: 'Product',
    component: () => import('@/layout/index.vue'),
    meta: {
      title: '商品管理',
      icon: 'ele-HomeFilled'
    },
    children: [
      {
        path: 'trademark',
        name: 'Trademark',
        component: () => import('@/views/parcent/trademark/index.vue'),
        meta: {
          title: '品牌管理'
        }
      },
      {
        path: 'attr',
        name: 'Attr',
        component: () => import('@/views/parcent/attr/index.vue'),
        meta: {
          title: '平台管理'
        }
      },
      {
        path: 'spu',
        name: 'Spu',
        component: () => import('@/views/parcent/spu/index.vue'),
        meta: {
          title: 'SPU管理'
        }
      },
      {
        path: 'sku',
        name: 'Sku',
        component: () => import('@/views/parcent/sku/index.vue'),
        meta: {
          title: 'SKU管理'
        }
      },
      {
        path: 'demo',
        name: 'Demo',
        component: () => import('@/views/parcent/demo/index.vue'),
        meta: {
          title: '测试'
        }
      }
    ]
  },
  // 仓储管理
  {
    path: '/storage',
    name: 'Storage',
    component: () => import('@/layout/index.vue'),
    meta: {
      title: '仓储管理',
      icon: 'ele-HomeFilled'
    },
    children: [
      {
        path: 'putaway',
        name: 'Putaway',
        component: () => import('@/views/storage/putaway/index.vue'),
        meta: {
          title: '上架'
        }
      },
      {
        path: 'down',
        name: 'Down',
        component: () => import('@/views/storage/down/index.vue'),
        meta: {
          title: '下架'
        }
      }
    ]
  }
]

/**
 * 定义匹配任意路由
 */
/* 匹配任意的路由 必须最后注册 */
export const anyRoutes = {
  path: '/:pathMatch(.*)',
  name: 'Any',
  redirect: '/404',
  meta: {
    hidden: true
  }
}

export const allAsyncRoutes: Array<RouteRecordRaw> = []
